@extends('admin_system/public/layout')
@section('content')
    <div class="col-xs-12">
        <p class="float-left"><strong>当前位置：</strong>菜单管理>>菜单列表</p>
    </div>

    <div class="content-box col-xs-12 mt20 pb20 pt20">

        <table class="table table-hover table-bordered">
            <tr>
                <th>编号</th>
                <th>名称</th>
                <th>子菜单</th>
                <th>排序</th>
                <th>状态</th>
                <th>操作</th>
            </tr>

            @foreach($mainTitle as $title)
                <tr>
                    <td>{{$loop->iteration}}</td>
                    <td>{{$title->menu_name}}</td>
                    <td>
                        <table class="table table-bordered">
                            <tr>
                                <th>名称</th>
                                <th>排序</th>
                                <th>是否删除</th>
                                <th>链接</th>
                                <th>操作</th>
                            </tr>
                            @foreach($title->subTitle as $subTitle)
                                <tr>
                                    <td>{{$subTitle->menu_name}}</td>
                                    <td>{{$subTitle->sort}}</td>
                                    <td>{{$subTitle->is_delete}}</td>
                                    <td>{{$subTitle->link_url}}</td>
                                    <td>
                                        @if($subTitle->is_delete == 1)
                                            <a class="btn btn-xs btn-default" href="{{asset('admin_system/menu/close_or_show?isDelete=0&menuId='.$subTitle->menu_id)}}">显示</a>
                                        @else
                                            <a class="btn btn-xs btn-danger" href="{{asset('admin_system/menu/close_or_show?isDelete=1&menuId='.$subTitle->menu_id)}}">关闭</a>
                                        @endif
                                            <a class="btn btn-xs btn-info" href="{{asset('admin_system/menu/edit_menu_index?menuId='.$subTitle->menu_id)}}">编辑</a>
                                            <a class="btn btn-xs btn-warning" href="{{asset('admin_system/menu/delete_menu?menuId='.$subTitle->menu_id)}}" onclick="return confirm('确定彻底删除吗');">删除</a>
                                    </td>
                                </tr>
                            @endforeach
                        </table>
                    </td>

                    <td>{{$title->sort}}</td>

                    <td>
                        @if($title->is_delete == 1)
                            <span class="glyphicon glyphicon-remove text-gray"></span>
                        @else
                            <span class="glyphicon glyphicon-ok text-green"></span>
                        @endif
                    </td>

                    <td>
                        <a href="{{asset('admin_system/menu/edit_menu_index?menuId='.$title->menu_id)}}" class="btn btn-xs btn-info">编辑</a>
                        <a href="{{asset('admin_system/menu/delete?adId='.$title->menu_id)}}" class="btn btn-xs btn-danger">删除</a>
                        @if($title->is_delete == 1)
                            <a class="btn btn-xs btn-info" href="{{asset('admin_system/menu/close_or_show?isDelete=0&adId='.$title->menu_id)}}">显示</a>
                        @else
                            <a class="btn btn-xs btn-warning" href="{{asset('admin_system/menu/close_or_show?isDelete=1&adId='.$title->menu_id)}}">关闭</a>
                        @endif
                    </td>
                </tr>
            @endforeach
        </table>
    </div>
@endsection
